package com.woniuxy.micropurchaseserver.purchaseordermsg.controller;

import com.woniuxy.micropurchaseserver.bean.PurchaseOrderBean;
import com.woniuxy.micropurchaseserver.bean.PurchaseReturnBean;
import com.woniuxy.micropurchaseserver.purchaseordermsg.service.PurchaseOrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/purchaseOrder")
public class PurchaseOrderController {
    @Resource
    private PurchaseOrderService purchaseOrderService;
    @RequestMapping(value = "/inc",produces = {"application/json;charset=utf-8"})
    public Long IncPurchaseOrder(PurchaseOrderBean purchaseOrderBean){
        Long i =purchaseOrderService.InsertPurchaseOrder(purchaseOrderBean);
        return i;
    }
    @RequestMapping(value = "/find",produces = {"application/json;charset=utf-8"})
    public List<PurchaseOrderBean> FindPurchaseOrder(PurchaseOrderBean purchaseOrderBean){
        List<PurchaseOrderBean> purchaseOrderBeans =purchaseOrderService.findAllPurchaseOrder(purchaseOrderBean);
        return purchaseOrderBeans;
    }
    @RequestMapping(value = "/update",produces = {"application/json;charset=utf-8"})
    public Integer UpdatePurchaseOrder(PurchaseOrderBean purchaseOrderBean){
        Integer i =purchaseOrderService.UpdatePurchaseOrder(purchaseOrderBean);
        return i;
    }
    @RequestMapping(value = "/del",produces = {"application/json;charset=utf-8"})
    public Integer DelPurchaseOrder(Integer id){
        Integer i =purchaseOrderService.DeletePurchaseOrderById(id);
        return i;
    }
}
